package com.iqiyi.pps.epg.core.model.program;

/**
 * Created by karkarrotxu on 2018/3/5.
 */
public class ProgramFeedData {

    private long id;
    private long fatherId;
    private long startTime;
    private long programQipuId;
    private boolean readyToRemove = false;
    private long lastExcuteTime;
    private long overCheckTime;
    public enum STATUS {
         IN_WAIT, PHASE_CHECK_SECOND, PHASE_OVER_CHECK
    }
    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public long getFatherId() {
        return fatherId;
    }

    public void setFatherId(long fatherId) {
        this.fatherId = fatherId;
    }

    public long getStartTime() {
        return startTime;
    }

    public void setStartTime(long startTime) {
        this.startTime = startTime;
    }

    public long getProgramQipuId() {
        return programQipuId;
    }

    public void setProgramQipuId(long programQipuId) {
        this.programQipuId = programQipuId;
    }

    public long getOverCheckTime() {
        return overCheckTime;
    }

    public void setOverCheckTime(long overCheckTime) {
        this.overCheckTime = overCheckTime;
    }

    public long getLastExcuteTime() {
        return lastExcuteTime;
    }

    public void setLastExcuteTime(long lastExcuteTime) {
        this.lastExcuteTime = lastExcuteTime;
    }

    public boolean isReadyToRemove() {
        return readyToRemove;
    }

    public void setReadyToRemove(boolean readyToRemove) {
        this.readyToRemove = readyToRemove;
    }

    public void initByTime(long startTime) {
        this.startTime = startTime;
        this.overCheckTime = startTime + 600000L;
        this.lastExcuteTime = System.currentTimeMillis();
    }

    public STATUS getCheckStatus(long checkTime) {
        if (checkTime >= overCheckTime) {
            return STATUS.PHASE_OVER_CHECK;
        } else if (checkTime >= startTime) {
            return lastExcuteTime > startTime ? STATUS.IN_WAIT : STATUS.PHASE_CHECK_SECOND;
        } else {
            return STATUS.IN_WAIT;
        }
    }
}
